package com.jiangcheng.demo.websocket;

import com.alibaba.fastjson.JSON;
import lombok.Data;

@Data
public class WebSocketMessageEntity {
    private String fromId; // 谁发的

    private String toId; // 发给谁

    private String msg; // 信息

    private String fromUsername;

    private String fromUserPic;

    // 行为 1为私信 2 为群聊
    private Integer action;
    // 时间
    private String time;

    public WebSocketMessageEntity() {

    }

    public WebSocketMessageEntity(String fromId, String toId, String msg, String fromUsername, String fromUserPic) {
        this.fromId = fromId;
        this.toId = toId;
        this.msg = msg;
        this.fromUsername = fromUsername;
        this.fromUserPic = fromUserPic;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }
}
